<div class="films view">
<h2><?php  echo __('Film');?></h2>
	<div class="imagenFilm">
			<?php echo $this->Html->image($imagen,array('alt' => 'No se encuentra la imagen', 'url' => '/films/view/1', 'class' =>'imagen')); ?>
	</div>
	<div class="detallesFilm">
		<dl>
			<dt><?php echo __('Title'); ?></dt>
			<dd>
				<?php echo h($title); ?>
				&nbsp;
			</dd>
			<dt><?php echo __('Synopsis'); ?></dt>
			<dd>
				<?php echo h($synopsis); ?>
				&nbsp;
			</dd>
			<dt><?php echo __('Release Date'); ?></dt>
			<dd>
				<?php echo h($release_dates); ?>
				&nbsp;
			</dd>
			<dt><?php echo __('Duration'); ?></dt>
			<dd>
				<?php echo h($duration); ?>
				&nbsp;min
			</dd>
			<dt><?php echo __('Calification'); ?></dt>
			<dd>
				<?php 
					for($i=0;$i<$calification; $i++)
						if($i%2==0)
							echo $this->Html->image('HalfStarLeft.png'); 
						else
							echo $this->Html->image('HalfStarRight.png'); 		
					for($i=$calification;$i<10 ;$i++)
						if($i%2==0)
							echo $this->Html->image('HalfStarGrayLeft.png'); 
						else
							echo $this->Html->image('HalfStarGrayRight.png'); 
				?>
				&nbsp;
			</dd>
			<dt><?php echo __('Genres'); ?></dt>
			<dd>
				<ul class="lista">
				<?php
					foreach ($Genre as $g): ?>
						
						<li><?php echo $g;?></li>
				<?php endforeach; ?>
				</ul>
				
			</dd>
			<dt><?php echo __('Actors'); ?></dt>
			<dd>
				<ul class="lista">
				<?php
					foreach ($actors as $actor): ?>
						<li><?php 
							if($actor['exist'])
								echo $this->Html->Link($actor['name'],array('controller'=>'actors','action'=>'view',$actor['id']));
							else
								echo h($actor['name']);
							?></li>
								
				<?php endforeach; ?>
				</ul>
				&nbsp;
				
			</dd>
			<dt><?php echo __('Directors'); ?></dt>
			<dd>
				<ul class="lista">
				<?php
					foreach ($directors as $director): ?>
						<li><?php 
							if($director['exist'])
								echo $this->Html->Link($director['name'],array('controller'=>'actors','action'=>'view',$director['id']));
							else
								echo h($director['name']);
							?></li>
				<?php endforeach; ?>
				</ul>
			</dd>
			<dt><?php echo __('Related films'); ?></dt>
			<dd>
				<?php
					if(!empty($related))
					foreach ($related as $f): 
						if($f['exist']){
							 echo '<li>'.$this->Html->Link($f['title'],array('controller'=>'films','action'=>'view',$f['id'])).'</li>';
						}
						else
							echo '<li>'.$this->Html->Link($f['title'],array('controller'=>'WebService','action'=>'view',$f['id'])).'</li>';
				 endforeach; ?>
				&nbsp;
			</dd>
			
		</dl>
	</div>
	
	<div id="fb-root"></div>
	<script type="text/javascript">
		window.fbAsyncInit = function() {
			FB.init({
				status     : true, // check login status
				cookie     : true, // enable cookies to allow the server to access the session
				xfbml      : true  // parse XFBML
			});
		};	
		// Load the SDK Asynchronously
		(function(d){
			var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
			if (d.getElementById(id)) {return;}
			js = d.createElement('script'); js.id = id; js.async = true;
			js.src = "//connect.facebook.net/es_LA/all.js";
			ref.parentNode.insertBefore(js, ref);
		}(document));
	</script>
	<fb:like send="false" width="650" show_faces="true" colorscheme="dark"></fb:like>
	<?php
		$url ="http://".$_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
		$url= str_replace('&',"&amp;",$url);
	?>
	<div class="fb-comments" data-href="<?php echo $url;?>" data-num-posts="2" data-width="650" data-colorscheme="dark"></div>
	
</div>


